package com.alex.controller.test.advice;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.ModelAndView;

@ControllerAdvice
public class GlobalExceptionHandlers {

    @ExceptionHandler({ArithmeticException.class})
    public ModelAndView test01(Exception e) {
        System.out.println(e);

        ModelAndView mv = new ModelAndView();
        mv.setViewName("error");
        mv.addObject("exception", e);
        return mv;
    }
}
